﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class Member_ModifyUserInfo : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            InitialPage();
        }        
    }

    private void InitialPage()
    {
        //GoShopping.Model.UserInfo ui = new GoShopping.Model.UserInfo();
        //GoShopping.BLL.UserBean ub=new GoShopping.BLL.UserBean();
        //ui = ub.GetOneUser(User.Identity.Name);
        lblName.Text = User.Identity.Name;
        ddlVocation.Items.Add(new ListItem("军人/干部"));
        ddlVocation.Items.Add(new ListItem("硬件/网络/软件/测试"));
        ddlVocation.Items.Add(new ListItem("公关/文密"));
        ddlVocation.Items.Add(new ListItem("经理/CEO"));
        ddlVocation.Items.Add(new ListItem("学生"));
        ddlVocation.Items.Add(new ListItem("自由职业者"));
    }
    protected void btnSave_Click(object sender, EventArgs e)
    {
        GoShopping.Model.UserInfo ui = new GoShopping.Model.UserInfo();
        GoShopping.BLL.UserBean ub = new GoShopping.BLL.UserBean();

        ui.ID = ub.GetOneUser(User.Identity.Name).ID;
        ui.Name = User.Identity.Name;
        ui.Sex = rblSex.SelectedValue;
        ui.Telephone = txtPhone.Text.Trim();
        ui.TrueName = txtTrueName.Text.Trim();
        ui.Vocation = ddlVocation.SelectedItem.Text;
        ui.Birthday = Convert.ToDateTime(txtBirthday.Text.Trim());

        ub.UpdateUser(ui);
        GoShopping.Utility.MessageBox.ShowAndRedirect(this, "修改成功!", "UserIndex.aspx");
        //Response.Redirect("UserIndex.aspx");
    }
}
